home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
gapdr.zip
/
DOOR.BAS
next >
Wrap
BASIC Source File
|
1989-01-18
|
15KB
|
336 lines
'****************************************************************************
'* Copyright (C) 1988,1989 The GAP Development Company
'*
'* All Rights Reserved
'*
'*
'* DOOR.BAS
'*
'* Demonstration program for GAPQBDR
'*
'* To compile : bc door;
'* To link : link door,,NUL.MAP,+gapqbdr
'*
'* Program will need access to DOOR.CNF, DOOR.SYS, GAPBBS.CNF, GAPDOS.DAT
'*
'****************************************************************************
'***********************************************************************
'* Before doing ANYTHING else, include the following file. *
'***********************************************************************
' $INCLUDE: 'GAPQBDR.BI'
'***********************************************************************
'* Declare any local variables prior to use *
'***********************************************************************
DIM oldbell AS INTEGER ' so we dont make sysop mad
DIM bobo AS INTEGER ' error return codes
DIM anystring AS STRING ' string used for most everything
DIM response AS STRING ' for getting responses
DIM menu AS STRING ' for building a menu
DIM prompt AS STRING ' for the command prompt
'***********************************************************************
'* Begin main line code here *
'***********************************************************************
'***********************************************************************
'* Before doing ANYTHING else, initialize the door with the following *
'* two function calls. *
'* Then, if you have any configuration options, line input them in *
'* and close file # 1. *
'***********************************************************************
CALL read.cnf("DOOR.CNF") ' read door configuration file
CALL init.door ' initialize the door
close #1 ' we dont have any configuration
' options so we will just close
'***********************************************************************
'* Now, we are going to keep track of the time credit variable that *
'* is stored in the GAPDOS.DAT file. We are going to do this because *
'* we are such nice people and we want to credit the caller for the *
'* time spent during our chat demonstration. Remember, at the *
'* beginning of the program, after initializing the door, is the *
'* place to do this because the variable 'timecredit' is initialized *
'* at doors beginning. *
'* *
'* NOTE! This function will fail (the reason for bobo) if GAPDOS.DAT *
'* does not exist (which it will not unless this program is being *
'* tested via the BBS door routines. If you need to test this *
'* feature, you will need to have a backup copy of GAPDOS.DAT that *
'* can be placed in your BBS default directory prior to running this *
'* demo! *
'***********************************************************************
bobo = read.gapdos% ' read the system file
IF bobo = 0 THEN
anystring = "GAPDOS.DAT says you have " + STR$(gapdos.timecredit)
anystring = anystring + " time credits (in minutes)."
CALL show.mess(anystring, NO, YES)
ELSE
CALL nl(2) ' display a couple of blank lines
CALL ansi(BRED) ' Humm, error time!
CALL show.mess("Could Not Open GAPDOS.DAT!", YES, YES)
END IF
CALL nl(2) ' display a couple of blank lines
'***********************************************************************
'* Change the color prior to displaying a prompt. Send a prompt to *
'* the caller and await an answer. *
'***********************************************************************
CALL ansi(BGREEN) ' set default color to Green
CALL show.mess("Please Enter Your Name : ", YES, NO) ' main output routine
response = SPACE$(30) ' must initialize all variables
' passed to get.string
CALL get.string(response) ' now get the caller's name
CALL nl(1) ' display a blank line
'***********************************************************************
'* An alternative way to change colors on the fly is to do it *
'* inline. It is also a bit faster since fewer function calls are *
'* made. But note that to change colors like this, you have to test *
'* if the caller is in color mode. *
'***********************************************************************
IF c.olor = 1 THEN
anystring = BCYAN + "Your name is : " + BRED + response + BCYAN + "."
ELSE
anystring = "Your name is : " + response + "."
END IF
CALL show.mess(anystring, NO, YES)' tell caller what was entered
CALL nl(1) ' display a blank line
CALL ansi(BGREEN) ' change colors
call show.mess("But on the BBS, your First Name is : "+first +".",NO,YES)
CALL nl(1) ' display a blank line
CALL pause ' wait for a key press before continuing
CALL nl(2) ' display a couple of blank lines
'***********************************************************************
'* The next example is the WRONG way to display a color string since *
'* it does not bother checking if the user is in color mode. *
'* The correct way is to check the c.olor variable. If it is a 1 *
'* then it is safe to send color. This is exactly what ansi() does. *
'***********************************************************************
anystring = BRED + "I'm going to mess up your black & white screen." + CRLF
anystring = anystring + "Because I'm not checking to see if you have " + CRLF
anystring = anystring + BWHITE + "Color turned on!!!"
CALL show.mess(anystring, NO, YES)
CALL nl(2) ' display a couple of blank lines
'***********************************************************************
'* It is now time to page the sysop. Just in case the sysop has his *
'* page bell turned off, we are going to cheat a bit and turn it on. *
'* For demonstration purposes only, you see! *
'* We will also demonstrate how to obtain and display the time left. *
'* *
'* Note that the 'timeleft' variable is automatically updated by the *
'* input routines. If you need to make sure that it is current, you *
'* can always call time.left() prior to using it. Since 'timeleft' *
'* is an integer, you will need to convert it to a string and then *
'* trim the leading space from it. *
'***********************************************************************
DO
CALL nl(1)
if c.olor = 1 then
anystring = YELLOW + "["+BRED + LTRIM$(str$(timeleft))+" mins" + YELLOW + "] To Page the Sysop, type a 'P' : "
else
anystring = "["+ LTRIM$(str$(timeleft))+" mins] To Page the Sysop, type a 'P' : "
end if
CALL show.mess(anystring, NO, NO)
response = " " ' must initialize get.string variable
CALL get